package handler

import (
	"common/response"
	"gateway/internal/svc"
	"gateway/internal/types"
	"gateway/websocket"
	"github.com/zeromicro/go-zero/rest/httpx"
	"net/http"
)

func websocketHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.UserToken
		if err := httpx.Parse(r, &req); err != nil {
			response.Response(w, nil, err)
			return
		}
		AccessSecret := svcCtx.Config.Auth.AccessSecret
		websocket.Start(w, r, req.Token, AccessSecret)
		//l := logic.NewWebsocketLogic(r.Context(), svcCtx)
		//err := l.Websocket(&req)
		// if err != nil {
		//	httpx.ErrorCtx(r.Context(), w, err)
		// } else {
		//	httpx.Ok(w)
		// }
		//response.Response(w, resp, err)
	}
}
